<template>
    <div class="wrape">
        <div>
            <input type="date" v-model="ddd">
        </div>
        <div>{{sss}}</div>
        <div @click="mmp()">{{data}}</div>
        <xDate ref="date" v-show="isShow" v-on:getDays="getDays" v-on:cancel="cancel" />
    </div>
</template>
<script>
import xDate from './xDate';
const weeks = ["壹","弍","叁","肆","伍","陆","日"];
export default {
    name: 'my-date',
    data(){
        return{
            data:"",
            ddd:"2018-09-28",
            isShow:false,
            sss:{}
        }
    },
    mounted(){
        let o_date = new Date();
        // o_date.setMonth(o_date.getMonth()-100);
        o_date.setMonth(9);
        o_date.setDate(0);
        let m_y = o_date.getFullYear();
        let m_m = o_date.getMonth()+1;
        let m_d = o_date.getDate();
        let data = o_date.getDay();
        console.log(m_y+"-"+m_m+"-"+m_d+" 星期"+data);
        this.data = m_y+"-"+m_m+"-"+m_d+" 星期"+weeks[data];
    },
    methods:{
        getDays(obj){
            console.log(obj);
            this.sss = obj;
        },
        cancel(){
            this.isShow = false;
        },
        mmp(){
            this.isShow = true;
        }
    },
    components:{
        xDate,
    }   
}
</script>
<style scoped>
    .wrape{
        position: absolute;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: #e6e6e6;
        text-align: center;
        line-height: 200px;
    }
</style>
